<?php

namespace App;

use Illuminate\Notifications\Notifiable;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
{
    use Notifiable;

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $guarded = ["id"];

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
        'password', 'remember_token',
    ];

    /**
     * The attributes that should be cast to native types.
     *
     * @var array
     */
    protected $casts = [
        'email_verified_at' => 'datetime',
    ];


    // 用户和场馆 多对多
    public function venues()
    {
        return $this->belongsToMany('App\Venue');
    }


    // 用户和活动 多对多
    public function games()
    {
        return $this->belongsToMany('App\Game',"user_game");
    }

    // 用户和订单 一对多
    public function my_orders()
    {
        return $this->hasMany("App\Order");
    }

  



}
